package com.efesco.finance.oughtReceive;

import com.bstek.dorado.data.*;
import com.bstek.dorado.common.*;
import com.efesco.common.Tools;
import com.efesco.system.User;
import com.bstek.dorado.view.data.ViewBaseField;

/**
 * queryOughtReceive_conditionDatasetListener
 */
public class queryOughtReceive_conditionDatasetListener extends AbstractDatasetListener {
  public void afterLoadData(Dataset dataset)
     throws Exception {
  	DoradoContext context = DoradoContext.getContext();
    Object obj = context.getAttribute(context.SESSION, "User");
    if (obj != null) {
    	User user = (User) obj;
    	String singleCompanyId = Tools.toStr(user.getSingleCompanyId());
    	int roleType = user.getRoleType();
    	if (!singleCompanyId.equals("") && roleType == 3)  {
    		((ViewBaseField)dataset.getField("companyName")).setVisible(false);
    		((ViewBaseField)dataset.getField("businessmanName")).setVisible(false);
    		dataset.insertRecord();
    		dataset.setString("singleCompanyId", singleCompanyId);
    	}
    }
  }

}
